﻿@model BankApp.Models.ExchangeRate

@{
    ViewBag.Title = "Details";
    bool createNew = ViewBag.CreateNew;
}

@using(@Html.BeginForm("Update", "ExchangeRates"))
{
    if (!createNew) { @Html.HiddenFor(m => m.Currency) }
    @Html.Hidden("createNew", createNew)

    <table>
        <tr>
            <td>@Html.LabelFor(m => m.Currency)</td>
            @if (createNew)
            {
                <td>@Html.DropDownListFor(m => m.Currency, new[] { new SelectListItem { Text = "USD", Value = "USD", Selected = true } })</td>
            }
            else 
            {
                <td>@Html.DisplayFor(m => m.Currency)</td>
            }
            <td>@Html.ValidationMessageFor(m => m.Currency)</td>
        </tr>
        
        <tr>
            <td>@Html.LabelFor(m => m.Date)</td>
            <td>@Html.Label(DateTime.Today.ToString("MM/dd/yyyy"))</td>
            <td>@Html.ValidationMessageFor(m => m.Date)</td>
        </tr>
        <tr>
            <td>@Html.LabelFor(m => m.Ask)</td>
            <td>@Html.TextBoxFor(m => m.Ask)</td>
            <td>@Html.ValidationMessageFor(m => m.Ask)</td>
        </tr>
        <tr>
            <td>@Html.LabelFor(m => m.Bid)</td>
            <td>@Html.TextBoxFor(m => m.Bid)</td>
            <td>@Html.ValidationMessageFor(m => m.Bid)</td>
        </tr>
    </table>
    <input type="submit" value="Save" />
}
